| Conditions | 2 |
| Total Lines | 73 |
| Code Lines | 67 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component, Fragment } from "react" |
||
| 52 | |||
| 53 | render() { |
||
| 54 | if ( |
||
| 55 | this.state.loading1 === false && |
||
| 56 | this.state.loading2 === false && |
||
| 57 | this.state.data |
||
| 58 | ) { |
||
| 59 | const { next, previous, ranking } = this.state.data |
||
| 60 | return ( |
||
| 61 | <Fragment> |
||
| 62 | <ul className="widget__filter" data-tabs id={`matches-${this.uuid}`}> |
||
| 63 | <li className="tabs-title"> |
||
| 64 | <a href={`#matches-${this.uuid}-prev`}>Vorige</a> |
||
| 65 | </li> |
||
| 66 | <li className="tabs-title is-active"> |
||
| 67 | <a href={`#matches-${this.uuid}-next`}>Volgende</a> |
||
| 68 | </li> |
||
| 69 | <li className="tabs-title"> |
||
| 70 | <a href={`#matches-${this.uuid}-rank`}>Ranking</a> |
||
| 71 | </li> |
||
| 72 | </ul> |
||
| 73 | <div data-tabs-content={`matches-${this.uuid}`}> |
||
| 74 | <div className="tabs-panel" id={`matches-${this.uuid}-prev`}> |
||
| 75 | {previous && ( |
||
| 76 | <MatchWithLogo match={previous.match} lazyload={true} /> |
||
| 77 | )} |
||
| 78 | {previous && ( |
||
| 79 | <MiniRanking ranking={[previous.opponent.ranking, ranking]} /> |
||
| 80 | )} |
||
| 81 | |||
| 82 | {!previous && <div className="matches_overview__wrapper">Geen vorige wedstrijden gevonden</div>} |
||
| 83 | </div> |
||
| 84 | <div |
||
| 85 | className="tabs-panel is-active" |
||
| 86 | id={`matches-${this.uuid}-next`} |
||
| 87 | > |
||
| 88 | {next && <MatchWithLogo match={next.match} lazyload={true} />} |
||
| 89 | {next && ( |
||
| 90 | <MiniRanking ranking={[next.opponent.ranking, ranking]} /> |
||
| 91 | )} |
||
| 92 | {!next && <div className="matches_overview__wrapper">Geen volgende wedstrijden gevonden</div>} |
||
| 93 | </div> |
||
| 94 | <div className="tabs-panel" id={`matches-${this.uuid}-rank`}> |
||
| 95 | <MiniRanking ranking={this.state.globalRanking} /> |
||
| 96 | </div> |
||
| 97 | </div> |
||
| 98 | </Fragment> |
||
| 99 | ) |
||
| 100 | } else { |
||
| 101 | return ( |
||
| 102 | <Fragment> |
||
| 103 | <ul className="widget__filter" data-tabs id={`matches-${this.uuid}`}> |
||
| 104 | <li className="tabs-title"> |
||
| 105 | <a href={`#matches-${this.uuid}-prev`}>Vorige</a> |
||
| 106 | </li> |
||
| 107 | <li className="tabs-title is-active"> |
||
| 108 | <a href={`#matches-${this.uuid}-next`}>Volgende</a> |
||
| 109 | </li> |
||
| 110 | <li className="tabs-title"> |
||
| 111 | <a href={`#matches-${this.uuid}-rank`}>Ranking</a> |
||
| 112 | </li> |
||
| 113 | </ul> |
||
| 114 | <div data-tabs-content={`matches-${this.uuid}`}> |
||
| 115 | <div className="tabs-panel" id={`matches-${this.uuid}-prev`} /> |
||
| 116 | <div |
||
| 117 | className="tabs-panel is-active" |
||
| 118 | id={`matches-${this.uuid}-next`} |
||
| 119 | > |
||
| 120 | Nog geen wedstrijden gekend |
||
| 121 | </div> |
||
| 122 | <div className="tabs-panel" id={`matches-${this.uuid}-rank`} /> |
||
| 123 | </div> |
||
| 124 | </Fragment> |
||
| 125 | ) |
||
| 155 |